package com.base.cn.platform.os.common.logger;

import com.base.cn.platform.os.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 终端日志
 *
 * @author s.li
 * @date 2019/04/29
 */
@Slf4j
public class TerminalUnitLogger {

    /**
     * 生成终端日志
     * @param request HttpServletRequest
     * @param userId 用户ID
     * @param terminalType 终端类型
     * @param tenantId 租户ID
     */
    public static void genTerminalLog(HttpServletRequest request,BigDecimal userId, String terminalType, BigDecimal tenantId){
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(userId).append("|").append(DateUtils.format(new Date(),"yyyy-MM-dd")).append("|").append(terminalType).append("|").append(tenantId);
        log.info(stringBuilder.toString());
    }
}
